import request from '@/utils/request'
import { getToken } from '@/utils/auth'

export function addPermission(data) {
  return request({
    url: '/api/admin/addPermission',
    method: 'post',
    params: data,
    headers: {
      Token: getToken()
    }
  })
}

export function getPermission(search_name,page,limit) {
  return request({
    url: '/api/admin/getPermission',
    method: 'get',
    headers: {
      Token: getToken()
    },
    params: {'val':search_name, 'page':page ,'limit':limit}
  })
}
export function updatePermission(res) {
  return request({
    url: '/api/admin/updatePermission',
    method: 'post',
    headers: {
      Token: getToken()
    },
    params:res
  })
}

export function deletePermission(id) {
  return request({
    url: '/api/admin/deletePermission',
    method: 'post',
    headers: {
      Token: getToken()
    },
    params: {'id':id}
  })
}
export function CheckPermissionShow(is_show ,id) {
  return request({
    url: '/api/admin/CheckPermissionShow',
    method: 'post',
    headers: {
      Token: getToken()
    },
    params: {'is_show':is_show ,'id':id}
  })
}

export function CheckPermissionStatus(status, id) {
  return request({
    url: '/api/admin/CheckPermissionStatus',
    method: 'post',
    headers: {
      Token: getToken()
    },
    params: {'status':status,'id':id}
  })
}
export function getPermissionOption() {
  return request({
    url: '/api/admin/getPermissionOption',
    method: 'get',
    headers: {
      Token: getToken()
    }
  })
}
